<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>

<script type="text/javascript">
$(document).ready(function() {
    $('#userTable').dataTable();
} );
</script>
<div style="margin-top: 5px; margin-bottom: 15px">
<h2 style="display: inline"><s:text name="listPositions.header"></s:text></h2>
<div style="float: right">
<s:if test="#session.loginToken.rights.contains('event_add_position')">
	<s:url id="addPositionUrlId" action="addPositionInput" namespace="/">
		<s:param name="eventId">
			<s:property value="eventId"></s:property>
		</s:param>
	</s:url>
	<s:a href="%{addPositionUrlId}">
		<img src="image/icons/0009_add.png" width="24" height="24"
			alt="profile" border="0" title="position hinzufügen">
	</s:a>
</s:if>
</div>
</div>
<table id="userTable" class="green">
	<thead>
		<tr>
			<th>ID</th>
			<th><s:text name="positionBean.positionName"></s:text></th>
			<th><s:text name="positionBean.positionDescription"></s:text></th>
			<th><s:text name="positionBean.positionValue"></s:text></th>
			<th><s:text name="positionBean.action"></s:text></th>
		</tr>
	</thead>
	<tbody>
		<s:iterator value="positionList">
			<tr>
				<td><s:property value="positionId"></s:property></td>
				<td><s:property value="positionName"></s:property></td>
				<td><s:property value="positionDescription"></s:property></td>
				<td><s:property value="positionValue"></s:property></td>
				<td>
				<!-- Position bearbeiten -->
				<s:if
					test="(#session.loginToken.rights.contains('event_edit_position')) || ((#session.loginToken.userId == userToEventBean.userId) && (#session.loginToken.rights.contains('event_edit_own_position')))">
					<s:url id="editPositionUrlId" action="editPositionInput"
						namespace="/">
						<s:param name="positionId">
							<s:property value="positionId"></s:property>
						</s:param>
					</s:url>
					<s:a href="%{editPositionUrlId}" title="%{getText('listPositions.editPosition')}">
						<img src="image/icons/0037_notepad.png" width="24" height="24"
							alt="edit position" border="0">
					</s:a>
				</s:if>
				<!-- Position löschen -->
				<s:if
					test="(#session.loginToken.rights.contains('event_delete_position')) || ((#session.loginToken.userId == userToEventBean.userId) && (#session.loginToken.rights.contains('event_delete_own_position')))">
					<s:url id="deletePositionUrlId" action="deletePosition"
						namespace="/">
						<s:param name="positionId">
							<s:property value="positionId"/>
						</s:param>
						<s:param name="eventId">
							<s:property value="eventId"/>
						</s:param>
					</s:url>
					<s:a href="%{deletePositionUrlId}" title="%{getText('listPositions.deletePosition')}">
						<img src="image/icons/0049_trash.png" width="24" height="24"
							alt="del position" border="0" onclick="return ask_first(this);">
					</s:a>
				</s:if>
				</td>
			</tr>
		</s:iterator>
	</tbody>
</table>

<s:url action="showEvent" namespace="/" id="showEventUrlId">
	<s:param name="eventId">
		<s:property value="eventId"/>
	</s:param>
</s:url>
<s:a href="%{showEventUrlId}"><s:text name="listPositions.backToEvent"></s:text></s:a>